package board;

import sgfRead.SgfPosition;

public class GoMove {

	public static final int _BLACK = 0;
	public static final int _WHITE = 1;
	private int own; // or black or white.

	//
	private int x;
	private int y;
	private char a;
	private char b;

	public GoMove(GoPosition pos) {
		this.x = pos.getX();
		this.y = pos.getY();
		this.a = pos.getA();
		this.b = pos.getB();
		if (pos.isBlack())
			this.own = _BLACK;
		else if (pos.isWhite())
			this.own = _WHITE;
	}

	public GoMove(int i, int j) {
		this.x = i;
		this.y = j;
		this.a = (char) (i + 'a');
		this.b = (char) (i + 'b');
	}

	public GoMove(char a, char b) {
		this.a = a;
		this.b = b;
		this.x = a - 'a';
		this.y = b - 'a';
	}

	public GoMove(SgfPosition pos) {
		this.a = pos.getA();
		this.b = pos.getB();
		this.x = a - 'a';
		this.y = b - 'b';
	}

	public void setPosition(int x, int y) {
		this.x = x;
		this.y = y;
	}

	public int getType() {
		return own;
	}

	public void setBlack() {
		this.own = _BLACK;
	}

	public void setWhite() {
		this.own = _WHITE;
	}

	public boolean isBlack() {
		return (own == _BLACK);
	}

	public boolean isWhite() {
		return (own == _WHITE);
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

}
